package com.itheima.网络编程.udp编程;

import java.io.IOException;
import java.net.*;
import java.util.Scanner;

public class UdpClident2 {
    public static void main(String[] args) throws IOException {
        DatagramSocket ds = new DatagramSocket();
        System.out.println("开启客户端:");
        Scanner sc = new Scanner(System.in);
        while (true) {
            System.out.println("发送数据:");
            String send = sc.next();
            if("886".equals(send)){
                break;
            }
            DatagramPacket dp = new DatagramPacket(send.getBytes(), send.getBytes().length, InetAddress.getByName("127.0.0.1"), 10000);
            ds.send(dp);
        }
    }
}
